'use strict'

define([ 'jquery', 'bootstrap', 'select2', 'shiftform', 'validate',
        'validate.en', 'datetimepicker', 'datetimepickerCN'  ], function($) {
    return {
        init : function() {
        	$("#selFirstCat").change(function(){
        		var fCat = $("#selFirstCat").val();
        		if(fCat!=null&& catMap[fCat] !=  undefined &&   catMap[fCat] !=  null){
        			var sCats = catMap[fCat].split(",");
        			document.getElementById("selSecondCat").options.length=0;
        			$("#selSecondCat").append("<option value=''>全部</option>");
        			    for(var i=0;i< sCats.length;i++){
        				   	//sCatObj。options=null;
        			    	$("#selSecondCat").append("<option value='"+sCats[i]+"'>"+allNameIdMap[sCats[i]]+"</option>");
        			    	//$("#selSecondCat option[index=i]").remove();
        			    }
        		}
        		if(fCat==null || fCat==""){
        			document.getElementById("selSecondCat").options.length=0;
        			$("#selSecondCat").append("<option value=''>全部</option>");
        		}

        	});

            $('[name="beginDateFrom"]').datetimepicker({
                format: 'yyyy-mm-dd',
                language: 'zh-CN',
                autoclose: 1,
                clearBtn:true,//清除按钮
                minView: 2,
                forceParse: 0
              });
              
              $('[name="beginDateTo"]').datetimepicker({
                  format: 'yyyy-mm-dd',
                  language: 'zh-CN',
                  autoclose: 1,
                  clearBtn:true,//清除按钮
                  minView: 2,
                  forceParse: 0
                });
              
              $('[name="endDateFrom"]').datetimepicker({
                  format: 'yyyy-mm-dd',
                  language: 'zh-CN',
                  autoclose: 1,
                  clearBtn:true,//清除按钮
                  minView: 2,
                  forceParse: 0
                });
            
            $('[name="endDateTo"]').datetimepicker({
                format: 'yyyy-mm-dd',
                language: 'zh-CN',
                autoclose: 1,
                clearBtn:true,//清除按钮
                minView: 2,
                forceParse: 0
              });
        }
    }
})
